{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>编辑文件</h5>
                </div>
                <div class="ibox-content layui-form">
                    <div class="layui-row layui-col-space10 layui-form-item ">

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">文件名称：</label>
                            <div class="layui-input-block">
                                <input type="text" name="mli_name" lay-verify="required" class="layui-input" placeholder="文件名称" value="{$file.mli_name}">
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">文件：</label>
                            <input type="hidden" name="mli_url" id="lay-img" lay-verify="image">
                            <div class="layui-input-block">
                                <div id="lay-upload">选择文件</div>
                                <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                                    预览：
                                    <div class="layui-upload-list" id="lay-list">
                                        <p class="layui-append-img">{$file.mli_url}</p>
                                    </div>
                                </blockquote>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">文件类型：</label>
                            <div class="layui-input-block">
                                <select name="mli_dis">
                                    <option value="1" {$file.mli_dis == 1 ? 'selected' : ''}>word </option>
                                    <option value="2" {$file.mli_dis == 2 ? 'selected' : ''}>excel</option>
                                    <option value="3" {$file.mli_dis == 3 ? 'selected' : ''}>pdf</option>
                                    <option value="4" {$file.mli_dis == 4 ? 'selected' : ''}>ppt</option>
                                    <option value="5" {$file.mli_dis == 5 ? 'selected' : ''}>txt</option>
                                </select>
                            </div>
                        </div>

                        <input type="hidden" value="{$mli_id}" name="mli_id">

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="component-form-element">保存
                                </button>
                                <button class="layui-btn layui-btn-primary" onclick="history.go(-1)">关闭</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    wk.uploadFiles({size:5,type:'txt,xlsx,xls,doc,docx,ppt,pdf',url:"{:url('Upload/upload')}",domain:""});
    layui.use(['form','upload','layedit','laydate'], function() {
        var form = layui.form;
//        form.verify({
//            editor:function(value,item){
//                if(editor.txt.html() == '<p><br></p>'){
//                    return '请填写内容';
//                }
//            }
//        });
        form.on('submit(component-form-element)', function (data) {
            $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
            $.ajax({
                url:"{:url('filesEdit')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    if (res.code == 200) {
                        wk.success(res.msg,"{:url('Match/lifeFiles')}")
                    } else {
                        wk.error(res.msg,'','$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\');');
                    }
                }
            });
        });

    });
</script>

</body>
</html>
